package wolftrace_company.study_android_ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import wolftrace_company.study_android_ui.R;
import wolftrace_company.study_android_ui.adapter.MyListAdapter;
import wolftrace_company.study_android_ui.bean.User;

/**
 * Created by SimpleTonOne on 2018/4/1.
 */

public class ListPageActivity extends AppCompatActivity {
    private ListView listView;
 //   private Button button;
    private MyListAdapter myListAdapter;
    private List<User> list;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        setContentView(R.layout.listpage);
        init();
        list = getData();
        myListAdapter = new MyListAdapter(list,ListPageActivity.this);
        listView.setAdapter(myListAdapter);


    }


    public void init(){
        listView = findViewById(R.id.myList);
    //    button = findViewById(R.id.list_btn);
    }
    public List<User> getData(){
        List<User> list  = new ArrayList<>();
        User user;
        for(int i = 0;i<=30;i++){
           user  = new User(String.valueOf(i),"a","as","asa","assa","as");
            list.add(user);
        }
        System.out.println(list);
        return list;
    }


}
